﻿@model ShopKart.Areas.Admin.Models.CategoryVm


@using (Ajax.BeginForm("AddUpdateCategory", "Category", new { area = "Admin" }, new AjaxOptions
{
    OnSuccess = "onSuccessCategory",
    OnBegin = "GlobalOnBeginFunction('.formSaveButton')",
    OnComplete = "GlobalOnCompleteFunction('.formSaveButton')"
}, new { @class = "horizontal-form" }))
{
    <div class="modal-body">
        @Html.Partial("~/Views/Shared/_ShowMessage.cshtml")

        @Html.HiddenFor(x => x.CategoryId)
        
        <div class="form-body">
            <div class="row">
                <div class="col-md-6">
                    <div class="form-group">
                        @Html.LabelFor(x => x.CategoryName, new { @class = "control-label" })
                        @Html.TextBoxFor(x => x.CategoryName, new { @class = "form-control", placeholder = "Enter Category Name" })
                        <span class="help-block">@Html.ValidationMessageFor(x => x.CategoryName)</span>
                    </div>
                </div>
                <!--/span-->
                <div class="col-md-6">
                    <div class="form-group">
                        @Html.LabelFor(x => x.ParentId, new { @class = "control-label" })
                        @Html.DropDownListFor(x => x.ParentId, new SelectList(Model.Categories, "CategoryId", "CategoryName"), "--Select--", new { @id = "ddlCategory", @class = "form-control", data_placeholder = "Select Category..." })
                    </div>
                </div>
                <!--/span-->
            </div>
        </div>
    </div>
    <div class="modal-footer">
        <button type="button" data-dismiss="modal" class="btn default">Close</button>
        @*<button type="submit" class="btn green btnSaveCategory">Save</button>*@

        <button type="submit" class="btn green btnSaveCategory ladda-button formSaveButton" data-style="zoom-in">
            <span class="ladda-label">Save</span>
        </button>
    </div>
}

